﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using CIAWorldMap;

namespace LaoMap
{
    /// <summary>
    /// Interaction logic for DlgRouteGenereator.xaml
    /// </summary>
    public partial class DlgRouteGenereator : Window
    {
        public CloseDlg _closeDlg;
        public SaveCache _saveCache;
        public ClearCurrent _clearCurrent;
        public AnimateCurrent _animateCurrent;

        public Dictionary<string, Place> _places;
        
        public DlgRouteGenereator()
        {
            InitializeComponent();
        }

        private void buttonDismiss_Click(object sender, RoutedEventArgs e)
        {
            if (_closeDlg != null)
            {
                _closeDlg();
            }
            Close();
        }

        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            string szRoute = textBoxRouteName.Text.Trim();

            if (szRoute.Length == 0)
            {
                MessageBox.Show("Need a route name!");
                return;
            }
            if (_saveCache != null)
            {
                _saveCache(szRoute);
            }
        }

        private void buttonClear_Click(object sender, RoutedEventArgs e)
        {
            if (_clearCurrent != null)
            {
                _clearCurrent();
            }

        }

        private void buttonAnimate_Click(object sender, RoutedEventArgs e)
        {
            if (_animateCurrent != null)
            {
                _animateCurrent(_places);
            }
        }
    }

    public delegate void CloseDlg();
    public delegate void SaveCache(string routeName);
    public delegate void ClearCurrent();
    public delegate void AnimateCurrent(Dictionary<string, Place> places);
}
